//
//  RHDeviceTopoMEFullView.m
//  RuiHeApp
//
//  Created by Yan Chen on 2024/8/16.
//

#import "RHDeviceTopoMEFullView.h"
#import "RHDeviceModel.h"

@interface RHDeviceTopoMEFullView()
@property (nonatomic ,strong) RHDeviceModel *devModel;

@property (nonatomic, strong) UIImageView *topoImg;

@property (nonatomic ,strong) QMUILabel *batGroupVolLab1;
@property (nonatomic ,strong) QMUILabel *batGroupVolLab3;
@property (nonatomic ,strong) QMUILabel *batGroupVolLab5;
@property (nonatomic ,strong) QMUILabel *batGroupVolLab2;
@property (nonatomic ,strong) QMUILabel *batGroupVolLab4;

@property (nonatomic ,strong) QMUILabel *batGroupTempLab1;
@property (nonatomic ,strong) QMUILabel *batGroupTempLab3;
@property (nonatomic ,strong) QMUILabel *batGroupTempLab5;
@property (nonatomic ,strong) QMUILabel *batGroupTempLab2;
@property (nonatomic ,strong) QMUILabel *batGroupTempLab4;

@property (nonatomic ,strong) QMUILabel *batSocLab;
@property (nonatomic ,strong) QMUILabel *batSohLab;
@property (nonatomic ,strong) QMUILabel *batVoltageLab;//总压
@property (nonatomic ,strong) QMUILabel *faultStateLab;//是否上高压故障

@property (nonatomic ,strong) QMUILabel *batBreakerLab;//交流断路器

@property (nonatomic ,strong) QMUILabel *batStockTempLab;
@property (nonatomic ,strong) QMUILabel *batStockHumLab;


//pcs三相电压
@property (nonatomic ,strong) QMUILabel *pcsVolLab1;
@property (nonatomic ,strong) QMUILabel *pcsVolLab2;
@property (nonatomic ,strong) QMUILabel *pcsVolLab3;
//pcs三相电流
@property (nonatomic ,strong) QMUILabel *pcsEleLab1;
@property (nonatomic ,strong) QMUILabel *pcsEleLab2;
@property (nonatomic ,strong) QMUILabel *pcsEleLab3;


@property (nonatomic ,strong) QMUILabel *pscStateLab;

@property (nonatomic ,strong) QMUILabel *totalPowerLab;

@property (nonatomic ,strong) QMUILabel *condenserLab;//交流断路器

@end
@implementation RHDeviceTopoMEFullView

-(instancetype)initWithDeviceModel:(RHDeviceModel *)devModel
{
    if(self = [super init]){
        _devModel = devModel;
        [self setupUI];
    }
    return self;
}

-(void)setTopo233Model:(RH233TopoModel *)topo233Model
{
    _topo233Model = topo233Model;
    
    //soc
    NSString *socStr = [NSString stringWithFormat:@"%@%%",[NSDecimalNumber decimalStringWithDouble:topo233Model.soc nullStr:@"--"]];
    self.batSocLab.text = [NSString stringWithFormat:@"%@",socStr];
    
    //soh
    NSString *sohStr = [NSString stringWithFormat:@"%@%%",[NSDecimalNumber decimalStringWithDouble:topo233Model.soh nullStr:@"--"]];
    self.batSohLab.text = [NSString stringWithFormat:@"%@",sohStr];
    
    //总压
    NSString *tvStr = [NSString stringWithFormat:@"%@V",[NSDecimalNumber decimalStringWithDouble:topo233Model.tv nullStr:@"--"]];
    self.batVoltageLab.text = [NSString stringWithFormat:@"%@",tvStr];
    
    self.faultStateLab.text = topo233Model.faultStatus?@"是".rh_localized:@"否".rh_localized;
    
    //电池组电压,温度
    NSString *vol1 = [NSDecimalNumber decimalStringWithDouble:topo233Model.pack1Voltage nullStr:@"--"];
    self.batGroupVolLab1.text = [NSString stringWithFormat:@"%@V",vol1];
    NSString *vol2 = [NSDecimalNumber decimalStringWithDouble:topo233Model.pack2Voltage nullStr:@"--"];
    self.batGroupVolLab2.text = [NSString stringWithFormat:@"%@V",vol2];
    NSString *vol3 = [NSDecimalNumber decimalStringWithDouble:topo233Model.pack3Voltage nullStr:@"--"];
    self.batGroupVolLab3.text = [NSString stringWithFormat:@"%@V",vol3];
    NSString *vol4 = [NSDecimalNumber decimalStringWithDouble:topo233Model.pack4Voltage nullStr:@"--"];
    self.batGroupVolLab4.text = [NSString stringWithFormat:@"%@V",vol4];
    NSString *vol5 = [NSDecimalNumber decimalStringWithDouble:topo233Model.pack5Voltage nullStr:@"--"];
    self.batGroupVolLab5.text = [NSString stringWithFormat:@"%@V",vol5];
    
    NSString *temp1 = [NSDecimalNumber decimalStringWithDouble:topo233Model.pack1Temperature nullStr:@"--"];
    self.batGroupTempLab1.text = [NSString stringWithFormat:@"%@℃",temp1];
    NSString *temp2 = [NSDecimalNumber decimalStringWithDouble:topo233Model.pack2Temperature nullStr:@"--"];
    self.batGroupTempLab2.text = [NSString stringWithFormat:@"%@℃",temp2];
    NSString *temp3 = [NSDecimalNumber decimalStringWithDouble:topo233Model.pack3Temperature nullStr:@"--"];
    self.batGroupTempLab3.text = [NSString stringWithFormat:@"%@℃",temp3];
    NSString *temp4 = [NSDecimalNumber decimalStringWithDouble:topo233Model.pack4Temperature nullStr:@"--"];
    self.batGroupTempLab4.text = [NSString stringWithFormat:@"%@℃",temp4];
    NSString *temp5 = [NSDecimalNumber decimalStringWithDouble:topo233Model.pack5Temperature nullStr:@"--"];
    self.batGroupTempLab5.text = [NSString stringWithFormat:@"%@℃",temp5];
    
    
    //断路器
    self.batBreakerLab.text = topo233Model.exDevIO04?@"闭合".rh_localized:@"断开".rh_localized;
    
    //电池仓温度
    NSString *stockTemp = [NSDecimalNumber decimalStringWithDouble:topo233Model.batCaseTemp nullStr:@"--"];
    self.batStockTempLab.text = [NSString stringWithFormat:@"%@℃",stockTemp];
    //电池仓湿度
    NSString *stockHum = [NSDecimalNumber decimalStringWithDouble:topo233Model.batCaseHumidity nullStr:@"--"];
    self.batStockHumLab.text = [NSString stringWithFormat:@"%@%%RH",stockHum];
    
    //pcs工作状态
    NSString *pcsState = @"--";
    switch (topo233Model.pcsRunningStatus) {
        case 0:
            pcsState = @"停止".rh_localized;
            break;
        case 1:
            pcsState = @"待机".rh_localized;
            break;
        case 2:
            pcsState = @"故障".rh_localized;
            break;
        case 3:
            pcsState = @"充电".rh_localized;
            break;
        case 4:
            pcsState = @"放电".rh_localized;
            break;
        case 5:
            pcsState = @"充电降额".rh_localized;
            break;
        case 6:
            pcsState = @"放电降额".rh_localized;
            break;
        default:
            break;
    }
    self.pscStateLab.text = pcsState;
    
    //总有功功率
    NSString *totalPower = [NSDecimalNumber decimalStringWithDouble:topo233Model.pcsActivePwr nullStr:@"--"];
    self.totalPowerLab.text = [NSString stringWithFormat:@"%@kW",totalPower];
    
    //pcs三相电压电流
    NSString *pcsVol1 = [NSDecimalNumber decimalStringWithDouble:topo233Model.pcsGridUVUVoltage nullStr:@"--"];
    self.pcsVolLab1.text = [NSString stringWithFormat:@"%@V",pcsVol1];
    NSString *pcsVol2 = [NSDecimalNumber decimalStringWithDouble:topo233Model.pcsGridVVWVoltage nullStr:@"--"];
    self.pcsVolLab2.text = [NSString stringWithFormat:@"%@V",pcsVol2];
    NSString *pcsVol3 = [NSDecimalNumber decimalStringWithDouble:topo233Model.pcsGridWWUVoltage nullStr:@"--"];
    self.pcsVolLab3.text = [NSString stringWithFormat:@"%@V",pcsVol3];
    
    NSString *pcsEle1 = [NSDecimalNumber decimalStringWithDouble:topo233Model.pcsOutUCurrent nullStr:@"--"];
    self.pcsEleLab1.text = [NSString stringWithFormat:@"%@A",pcsEle1];
    NSString *pcsEle2 = [NSDecimalNumber decimalStringWithDouble:topo233Model.pcsOutVCurrent nullStr:@"--"];
    self.pcsEleLab2.text = [NSString stringWithFormat:@"%@A",pcsEle2];
    NSString *pcsEle3 = [NSDecimalNumber decimalStringWithDouble:topo233Model.pcsOutWCurrent nullStr:@"--"];
    self.pcsEleLab3.text = [NSString stringWithFormat:@"%@A",pcsEle3];
    
    //液冷工作状态
    NSString *lcus = @"--";
    //0:停止1:内循环2:制冷3:加热4:全自动(根据水温)，
    switch (topo233Model.lcustatus) {
        case 0:
            lcus = @"停止".rh_localized;
            break;
        case 1:
            lcus = @"内循环".rh_localized;
            break;
        case 2:
            lcus = @"制冷".rh_localized;
            break;
        case 3:
            lcus = @"加热".rh_localized;
            break;
        case 4:
            lcus = @"全自动".rh_localized;
            break;
        default:
            break;
    }
    self.condenserLab.text = lcus;
}


-(void)setupUI
{
    kWeakSelf;
    UIImage *image = [UIImage imageNamed:@"me_dc_233_full"];
    _topoImg = [[UIImageView alloc]initWithImage:image];
    [self addSubview:_topoImg];
    [_topoImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_offset(5);
        make.bottom.mas_offset(-5);
        make.centerX.mas_offset(-25);
        make.width.equalTo(_topoImg.mas_height).multipliedBy(image.size.width/image.size.height);
    }];
    
    UIView *leftView1 = kView;
    UIView *leftView2 = kView;
//    leftView1.backgroundColor = kRandomColor;
//    leftView2.backgroundColor = kRandomColor;
    [self addSubview:leftView1];
    [self addSubview:leftView2];
    [leftView1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.bottom.mas_offset(15);
    }];
    [leftView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(leftView1.mas_right);
        make.right.equalTo(weakSelf.topoImg.mas_left).offset(25);
        make.top.bottom.width.equalTo(leftView1);
    }];
    
    _batGroupVolLab1 =  [QMUILabel labelWithText:@"--V".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [leftView1 addSubview:_batGroupVolLab1];
    [_batGroupVolLab1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(15);
        make.top.mas_offset(kScaleW(20));
    }];
    QMUILabel *batGroupVolTitleLab1 = [QMUILabel labelWithText:@"电池组电压".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    [leftView1 addSubview:batGroupVolTitleLab1];
    [batGroupVolTitleLab1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.batGroupVolLab1);
        make.right.mas_offset(0);
        make.top.equalTo(weakSelf.batGroupVolLab1.mas_bottom).offset(3);
    }];
    
    _batGroupVolLab3 =  [QMUILabel labelWithText:@"--V".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [leftView1 addSubview:_batGroupVolLab3];
    [_batGroupVolLab3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(batGroupVolTitleLab1);
        make.top.equalTo(batGroupVolTitleLab1.mas_bottom).mas_offset(5);
    }];
    QMUILabel *batGroupVolTitleLab3 = [QMUILabel labelWithText:@"电池组电压".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    [leftView1 addSubview:batGroupVolTitleLab3];
    [batGroupVolTitleLab3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.batGroupVolLab3);
        make.right.mas_offset(0);
        make.top.equalTo(weakSelf.batGroupVolLab3.mas_bottom).offset(3);
    }];
    
    _batGroupVolLab5 =  [QMUILabel labelWithText:@"--V".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [leftView1 addSubview:_batGroupVolLab5];
    [_batGroupVolLab5 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(batGroupVolTitleLab3);
        make.top.equalTo(batGroupVolTitleLab3.mas_bottom).mas_offset(5);
    }];
    QMUILabel *batGroupVolTitleLab5 = [QMUILabel labelWithText:@"电池组电压".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    [leftView1 addSubview:batGroupVolTitleLab5];
    [batGroupVolTitleLab5 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.batGroupVolLab5);
        make.right.mas_offset(0);
        make.top.equalTo(weakSelf.batGroupVolLab5.mas_bottom).offset(3);
    }];
    
    //3组温度
    _batGroupTempLab1 =  [QMUILabel labelWithText:@"--℃".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [leftView2 addSubview:_batGroupTempLab1];
    [_batGroupTempLab1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(15);
        make.top.equalTo(weakSelf.batGroupVolLab1);
    }];
    QMUILabel *batGroupTempTitleLab1 = [QMUILabel labelWithText:@"电池组温度".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    [leftView2 addSubview:batGroupTempTitleLab1];
    [batGroupTempTitleLab1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.batGroupTempLab1);
        make.top.equalTo(weakSelf.batGroupTempLab1.mas_bottom).offset(0);
    }];
    
    _batGroupTempLab3 =  [QMUILabel labelWithText:@"--℃".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [leftView2 addSubview:_batGroupTempLab3];
    [_batGroupTempLab3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(batGroupTempTitleLab1);
        make.top.equalTo(weakSelf.batGroupVolLab3);
    }];
    QMUILabel *batGroupTempTitleLab3 = [QMUILabel labelWithText:@"电池组温度".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    [leftView2 addSubview:batGroupTempTitleLab3];
    [batGroupTempTitleLab3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.batGroupTempLab3);
        make.top.equalTo(batGroupVolTitleLab3).offset(0);
    }];
    
    _batGroupTempLab5 =  [QMUILabel labelWithText:@"--℃".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [leftView2 addSubview:_batGroupTempLab5];
    [_batGroupTempLab5 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(batGroupTempTitleLab3);
        make.top.equalTo(weakSelf.batGroupVolLab5);
    }];
    QMUILabel *batGroupTempTitleLab5 = [QMUILabel labelWithText:@"电池组温度".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    [leftView2 addSubview:batGroupTempTitleLab5];
    [batGroupTempTitleLab5 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.batGroupTempLab5);
        make.top.equalTo(batGroupVolTitleLab5).offset(0);
    }];
    
    
    _batSocLab =  [QMUILabel labelWithText:@"--%".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [leftView1 addSubview:_batSocLab];
    [_batSocLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(15);
        make.top.equalTo(weakSelf.topoImg.mas_centerY).offset(25);
    }];
    QMUILabel *socTitleLab = [QMUILabel labelWithText:@"电池SOC".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    [leftView1 addSubview:socTitleLab];
    [socTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.batSocLab);
        make.top.equalTo(weakSelf.batSocLab.mas_bottom).offset(0);
    }];
    
    //总压
    _batVoltageLab =  [QMUILabel labelWithText:@"--V".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [leftView1 addSubview:_batVoltageLab];
    [_batVoltageLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(15);
        make.top.equalTo(socTitleLab.mas_bottom).offset(10);
    }];
    QMUILabel *batVoltageTitleLab = [QMUILabel labelWithText:@"电池总压".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    [self addSubview:batVoltageTitleLab];
    [batVoltageTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.batVoltageLab);
        make.top.equalTo(weakSelf.batVoltageLab.mas_bottom).offset(0);
    }];
    
    //是否上高压故障
    _faultStateLab =  [QMUILabel labelWithText:@"--".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [leftView1 addSubview:_faultStateLab];
    [_faultStateLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(15);
        make.top.equalTo(batVoltageTitleLab.mas_bottom).offset(10);
    }];
    QMUILabel *faultStateTitleLab = [QMUILabel labelWithText:@"是否上高压故障".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    faultStateTitleLab.numberOfLines = 2;
    faultStateTitleLab.textAlignment = NSTextAlignmentLeft;
    faultStateTitleLab.adjustsFontSizeToFitWidth = YES;
    faultStateTitleLab.minimumScaleFactor = 0.8;
    [leftView1 addSubview:faultStateTitleLab];
    [faultStateTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.faultStateLab);
        make.right.mas_offset(-3);
        make.top.equalTo(weakSelf.faultStateLab.mas_bottom).offset(0);
    }];
    
    _batSohLab =  [QMUILabel labelWithText:@"--%".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [leftView2 addSubview:_batSohLab];
    [_batSohLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(15);
        make.top.equalTo(weakSelf.batSocLab);
    }];
    QMUILabel *sohTitleLab = [QMUILabel labelWithText:@"电池SOH".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    [self addSubview:sohTitleLab];
    [sohTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.batSohLab);
        make.top.equalTo(socTitleLab).offset(0);
    }];
    
    
    
    _batBreakerLab =  [QMUILabel labelWithText:@"--".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [self addSubview:_batBreakerLab];
    [_batBreakerLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(sohTitleLab);
        make.top.equalTo(batVoltageTitleLab.mas_bottom).offset(10);
    }];
    QMUILabel *batBreakerTitleLab = [QMUILabel labelWithText:@"交流断路器状态".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    [self addSubview:batBreakerTitleLab];
    [batBreakerTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.batBreakerLab);
        make.top.equalTo(weakSelf.batBreakerLab.mas_bottom).offset(0);
    }];
    
    //----------------------------右边---------------------------------------
    
    UIView *rightView1 = kView;
    UIView *rightView2 = kView;
    UIView *rightView3 = kView;
//    rightView1.backgroundColor = kRandomColor;
//    rightView2.backgroundColor = kRandomColor;
//    rightView3.backgroundColor = kRandomColor;
    [self addSubview:rightView1];
    [self addSubview:rightView2];
    [self addSubview:rightView3];
    [rightView1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.topoImg.mas_right).offset(-15);
        make.top.bottom.mas_offset(0);
    }];
    [rightView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(rightView1.mas_right);
        make.top.bottom.width.equalTo(rightView1);
    }];
    [rightView3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(rightView2.mas_right);
        make.right.mas_offset(0);
        make.top.bottom.width.equalTo(rightView2);
    }];
    
    //-------右边
    _batStockTempLab =  [QMUILabel labelWithText:@"--℃".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [rightView1 addSubview:_batStockTempLab];
    [_batStockTempLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(0);
        make.top.mas_offset(15);
    }];
    QMUILabel *batStockTempTitleLab = [QMUILabel labelWithText:@"电池仓温度".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    batStockTempTitleLab.textAlignment = NSTextAlignmentLeft;
    batStockTempTitleLab.numberOfLines = 2;
    batStockTempTitleLab.adjustsFontSizeToFitWidth = YES;
    batStockTempTitleLab.minimumScaleFactor = 0.6;
    [rightView1 addSubview:batStockTempTitleLab];
    [batStockTempTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.batStockTempLab);
        make.right.mas_offset(-3);
        make.top.equalTo(weakSelf.batStockTempLab.mas_bottom).offset(3);
    }];
   
    _batGroupVolLab2 =  [QMUILabel labelWithText:@"--V".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [rightView1 addSubview:_batGroupVolLab2];
    [_batGroupVolLab2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(batStockTempTitleLab);
        make.top.equalTo(weakSelf.batStockTempLab.mas_bottom).mas_offset(30);
    }];
    QMUILabel *batStockTempTitleLab2 = [QMUILabel labelWithText:@"电池组电压".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    batStockTempTitleLab2.textAlignment = NSTextAlignmentLeft;
    batStockTempTitleLab2.adjustsFontSizeToFitWidth = YES;
    batStockTempTitleLab2.minimumScaleFactor = 0.8;
    [rightView1 addSubview:batStockTempTitleLab2];
    [batStockTempTitleLab2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.batGroupVolLab2);
        make.right.mas_offset(-3);
        make.top.equalTo(weakSelf.batGroupVolLab2.mas_bottom).offset(3);
    }];
    
    _batGroupVolLab4 =  [QMUILabel labelWithText:@"--V".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [rightView1 addSubview:_batGroupVolLab4];
    [_batGroupVolLab4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(batStockTempTitleLab);
        make.top.equalTo(batStockTempTitleLab2.mas_bottom).mas_offset(10);
    }];
    QMUILabel *batStockTempTitleLab4 = [QMUILabel labelWithText:@"电池组电压".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    batStockTempTitleLab4.textAlignment = NSTextAlignmentLeft;
    batStockTempTitleLab4.adjustsFontSizeToFitWidth = YES;
    batStockTempTitleLab4.minimumScaleFactor = 0.8;
    [rightView1 addSubview:batStockTempTitleLab4];
    [batStockTempTitleLab4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.batGroupVolLab4);
        make.right.mas_offset(-3);
        make.top.equalTo(weakSelf.batGroupVolLab4.mas_bottom).offset(3);
    }];
    
    //电池仓湿度
    _batStockHumLab =  [QMUILabel labelWithText:@"--%RH".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [rightView2 addSubview:_batStockHumLab];
    [_batStockHumLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(0);
        make.top.equalTo(weakSelf.batStockTempLab);
    }];
    QMUILabel *batStockHumTitleLab1 = [QMUILabel labelWithText:@"电池仓湿度".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    batStockHumTitleLab1.textAlignment = NSTextAlignmentLeft;
    [rightView2 addSubview:batStockHumTitleLab1];
    [batStockHumTitleLab1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.batStockHumLab);
        make.top.equalTo(batStockTempTitleLab);
    }];
    
    _batGroupTempLab2 =  [QMUILabel labelWithText:@"--℃".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [rightView2 addSubview:_batGroupTempLab2];
    [_batGroupTempLab2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(batStockHumTitleLab1);
        make.top.equalTo(weakSelf.batGroupVolLab2);
    }];
    QMUILabel *batStockHumTitleLab2 = [QMUILabel labelWithText:@"电池组温度".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    batStockHumTitleLab2.textAlignment = NSTextAlignmentLeft;
    [rightView2 addSubview:batStockHumTitleLab2];
    [batStockHumTitleLab2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.batGroupTempLab2);
        make.top.equalTo(batStockTempTitleLab2);
    }];
    
    _batGroupTempLab4 =  [QMUILabel labelWithText:@"--℃".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [rightView2 addSubview:_batGroupTempLab4];
    [_batGroupTempLab4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(batStockHumTitleLab2);
        make.top.equalTo(weakSelf.batGroupVolLab4);
    }];
    QMUILabel *batStockHumTitleLab4 = [QMUILabel labelWithText:@"电池组温度".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    batStockHumTitleLab4.textAlignment = NSTextAlignmentLeft;
    [rightView2 addSubview:batStockHumTitleLab4];
    [batStockHumTitleLab4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.batGroupTempLab4);
        make.top.equalTo(batStockTempTitleLab4).offset(0);
    }];
    
    //pcs工作状态
    _pscStateLab =  [QMUILabel labelWithText:@"--".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [rightView1 addSubview:_pscStateLab];
    [_pscStateLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(batStockTempTitleLab4);
        make.top.equalTo(batStockTempTitleLab4.mas_bottom).offset(kScaleW(15));
    }];
    QMUILabel *pcsStateTitleLab = [QMUILabel labelWithText:@"PCS工作状态".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    pcsStateTitleLab.textAlignment = NSTextAlignmentLeft;
    pcsStateTitleLab.adjustsFontSizeToFitWidth = YES;
    pcsStateTitleLab.minimumScaleFactor= 0.5;
    [rightView1 addSubview:pcsStateTitleLab];
    [pcsStateTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.pscStateLab);
        make.right.mas_offset(-3);
        make.top.equalTo(weakSelf.pscStateLab.mas_bottom).offset(3);
    }];
    
    //总有功功率
    _totalPowerLab =  [QMUILabel labelWithText:@"--kW".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [rightView2 addSubview:_totalPowerLab];
    [_totalPowerLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(batStockHumTitleLab4);
        make.top.equalTo(weakSelf.pscStateLab);
    }];
    QMUILabel *totalPowerTitleLab = [QMUILabel labelWithText:@"总有功功率".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    totalPowerTitleLab.textAlignment = NSTextAlignmentLeft;
    [rightView2 addSubview:totalPowerTitleLab];
    [totalPowerTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.totalPowerLab);
        make.top.equalTo(pcsStateTitleLab);
    }];
    
    //pcs三相电压
    _pcsVolLab1 =  [QMUILabel labelWithText:@"--V".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [rightView1 addSubview:_pcsVolLab1];
    [_pcsVolLab1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(0);
        make.top.equalTo(pcsStateTitleLab.mas_bottom).mas_offset(5);
    }];
    QMUILabel *pcsVolTitleLab1 = [QMUILabel labelWithText:@"U".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    [rightView1 addSubview:pcsVolTitleLab1];
    [pcsVolTitleLab1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.pcsVolLab1);
        make.top.equalTo(weakSelf.pcsVolLab1.mas_bottom).offset(3);
    }];
    
    _pcsVolLab2 =  [QMUILabel labelWithText:@"--V".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [rightView2 addSubview:_pcsVolLab2];
    [_pcsVolLab2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(0);
        make.top.equalTo(weakSelf.pcsVolLab1).mas_offset(0);
    }];
    QMUILabel *pcsVolTitleLab2 = [QMUILabel labelWithText:@"V".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    [rightView2 addSubview:pcsVolTitleLab2];
    [pcsVolTitleLab2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.pcsVolLab2);
        make.top.equalTo(pcsVolTitleLab1);
    }];
    
    _pcsVolLab3 =  [QMUILabel labelWithText:@"--V".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [rightView3 addSubview:_pcsVolLab3];
    [_pcsVolLab3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(0);
        make.top.equalTo(weakSelf.pcsVolLab1);
    }];
    QMUILabel *pcsVolTitleLab3 = [QMUILabel labelWithText:@"W".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    [rightView3 addSubview:pcsVolTitleLab3];
    [pcsVolTitleLab3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.pcsVolLab3);
        make.top.equalTo(pcsVolTitleLab1);
    }];
    
    //pcs三相电流
    _pcsEleLab1 =  [QMUILabel labelWithText:@"--A".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [rightView1 addSubview:_pcsEleLab1];
    [_pcsEleLab1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(0);
        make.top.equalTo(pcsVolTitleLab1.mas_bottom).mas_offset(5);
    }];
    QMUILabel *pcsEleTitleLab1 = [QMUILabel labelWithText:@"U".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    [rightView1 addSubview:pcsEleTitleLab1];
    [pcsEleTitleLab1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.pcsEleLab1);
        make.top.equalTo(weakSelf.pcsEleLab1.mas_bottom).offset(5);
    }];
    
    _pcsEleLab2 =  [QMUILabel labelWithText:@"--A".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [rightView2 addSubview:_pcsEleLab2];
    [_pcsEleLab2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(0);
        make.top.equalTo(weakSelf.pcsEleLab1).mas_offset(0);
    }];
    QMUILabel *pcsEleTitleLab2 = [QMUILabel labelWithText:@"V".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    [rightView2 addSubview:pcsEleTitleLab2];
    [pcsEleTitleLab2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.pcsEleLab2);
        make.top.equalTo(pcsEleTitleLab1);
    }];
    
    _pcsEleLab3 =  [QMUILabel labelWithText:@"--V".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [rightView3 addSubview:_pcsEleLab3];
    [_pcsEleLab3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(0);
        make.top.equalTo(weakSelf.pcsEleLab1).mas_offset(0);
    }];
    QMUILabel *pcsEleTitleLab3 = [QMUILabel labelWithText:@"W".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    [rightView3 addSubview:pcsEleTitleLab3];
    [pcsEleTitleLab3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.pcsEleLab3);
        make.top.equalTo(pcsEleTitleLab1).offset(0);
    }];
    
    
    QMUILabel *condenserTitleLab = [QMUILabel labelWithText:@"液冷机组工作状态".rh_localized font:kSYSTEMFONT(12) textColor:kCOLOR_HEX_A(@"171A1D", 0.6)];
    condenserTitleLab.textAlignment = NSTextAlignmentLeft;
    [self addSubview:condenserTitleLab];
    [condenserTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(pcsStateTitleLab);
        make.bottom.equalTo(weakSelf.topoImg.mas_bottom).offset(kUI_WINDOW_W==375?5:kScaleW(-3));
    }];
    _condenserLab =  [QMUILabel labelWithText:@"--".rh_localized font:kSYSTEMFONT(14) textColor:kCOLOR_HEX_A(@"132B88", 0.8)];
    [self addSubview:_condenserLab];
    [_condenserLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(condenserTitleLab);
        make.bottom.equalTo(condenserTitleLab.mas_top).offset(-5);
    }];
   
    //液冷机组工作状态
    condenserTitleLab.hidden = YES;
    self.condenserLab.hidden = YES;
    if ([self.devModel.deviceTypeCode isEqualToString:R_SM233120A0_US]||
        [self.devModel.deviceTypeCode isEqualToString:K_KS233125A0_US]) {
        pcsVolTitleLab1.hidden = YES;
        pcsVolTitleLab2.hidden = YES;
        pcsVolTitleLab3.hidden = YES;
        _pcsVolLab1.hidden = YES;
        _pcsVolLab2.hidden = YES;
        _pcsVolLab3.hidden = YES;
        [_pcsEleLab1 mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_offset(0);
            make.top.equalTo(pcsStateTitleLab.mas_bottom).mas_offset(10);
        }];
    }

}

@end
